<!DOCTYPE html>
<html xml:lang="zh-CN" lang="zh-CN" class=" " style="transform: none;">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, viewport-fit=cover" />
    <meta name="renderer" content="webkit" />
    <meta name="force-rendering" content="webkit" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <title>{cymini:cate field='name'/} - {$Think.config.web.web_title}</title>
    <meta name="description" content="{cymini:cate field='description'/}" />
    <meta name="keywords" content="{cymini:cate field='keywords'/}" />
    <meta property="og:type" content="index" />
    <meta property="og:title" content="{$Think.config.web.web_title}" />
    <meta property="og:image" content="{$Think.config.web.web_logo}" />
    <meta property="og:url" content="https://www.itmkk.com/" />
    <script src="{$view_path}/static/js/jquery-2.2.4.min.js"></script>
    <script src="{$view_path}/static/js/zblogphp.js"></script>
    <script src="{$view_path}/static/js/c_html_js_add.js"></script>


    <script src="{$view_path}/static/layui/layui.js" type="text/javascript"></script>
    <link rel="stylesheet" type="text/css" href="{$view_path}/static/layui/css/layui.css" />

    <script src="{$view_path}/static/js/imgUp.js"></script>
    <link rel="stylesheet" type="text/css" href="{$view_path}/static/css/imgUp.css" />
    <link rel="stylesheet" type="text/css" href="{$view_path}/static/css/pyq_album.css" />
    <link href="{$view_path}/static/css/font-awesome.min.css" rel="stylesheet" />
    <link rel="stylesheet" href="{$view_path}/static/css/style.css" type="text/css" media="all" />
    <link rel="stylesheet" href="{$view_path}/static/css/fancybox.css" type="text/css" media="all" />

    {include file='layout/icon'}
    <!--[if lt IE 9]><script src="https://cdn.staticfile.org/html5shiv/3.7.0/html5shiv.js"></script><![endif]-->
<style>
    .layui-form-label{
        width:100px;
    }
</style>
</head>
<body class="home home-category" style="transform: none;">

{include file='layout/navmenu'}

<main id="list-main" class="main-content container clearfix" style="transform: none;">
    <div class="container" style="min-height:460px;max-width:660px;">

        <div id="showAdd" style="display:none;">
            <form class="layui-form" id="fieldData" action="" lay-filter="fieldData" onsubmit="return false;">
                <input type="hidden" id="__token__" name="__token__" value="{:token()}">
                <div class="layui-form-item">
                    <label class="layui-form-label">失信者</label>
                    <div class="layui-input-block">
                        <input type="text" lay-verify="required" name="suspect" lay-verify="title" autocomplete="off" placeholder="QQ：123456，微信：Lkf123" class="layui-input">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">受害者</label>
                    <div class="layui-input-block">
                        <input type="text" lay-verify="required" name="victim" placeholder="QQ：123456，微信：Lkf123" autocomplete="off" class="layui-input">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">身份确认</label>
                    <div class="layui-input-block">
                        <input type="radio" name="status" value="1" title="确认骗子" checked>
                        <input type="radio" name="status" value="0" title="疑似骗子">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">验证码</label>
                    <div class="layui-input-inline">
                        <input type="text" name="code" lay-verify="required" lay-reqtext="请填写验证码" placeholder="" autocomplete="off" class="layui-input">
                    </div>

                    <label class="layui-form-label">Email</label>
                    <div class="layui-input-inline">
                        <input type="text" id="email" name="email" placeholder="Email..." lay-verify="required|email" lay-reqtext="请填写-Email" autocomplete="off" class="layui-input sendEmail">
                    </div>
                    <div class="layui-form-mid" style="padding: 0!important;">
                        <button type="button" id="setOut" class="layui-btn layui-btn-primary" lay-on="getVercode">获取验证码</button>
                    </div>
                </div>

                <div class="layui-form-item layui-form-text">
                    <label class="layui-form-label">备 注</label>
                    <div class="layui-input-block">
                        <textarea placeholder="请输入" class="layui-textarea" name="remarks">信息由受骗网友提供</textarea>
                    </div>
                </div>

                <div class="layui-upload">
                    <blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 11px;">
                        上传图片：
                        <div class="layui-form-item">
                            <div class="img-box full">
                                <section class="img-section">
                                    <div class="z_photo upimg-div clear">
                                        <section class="z_file fl">
                                            <img src="{$view_path}/static/images/all.png" data-name="thumbImg[]" title="" class="add-img">
                                            <div onclick="del_img(this)" class="del_img">删 除</div>
                                            <input type="file" name="file" id="gallery" onchange="batch_img(this,9)" class="file" accept="image/*" multiple="">
                                        </section>
                                    </div>
                                </section>
                            </div>
                        </div>
                    </blockquote>
                </div>

                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <button type="submit" class="layui-btn" lay-submit lay-filter="doSubmit">立即提交</button>
                        <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                    </div>
                </div>
            </form>
        </div>


        <div style="margin: 0 auto;max-width:420px;">
            <div style="margin:15px 15px;">
                <form method="get" name="search" action="" class="searchform">
                    <input type="hidden" value="{$Request.param.id?$Request.param.id:''}" name="id" class="text layui-input" />
                    <input type="text" value="{$Request.param.suspect?$Request.param.suspect:''}" name="suspect" placeholder="请输入失信者搜索..." class="text layui-input" />
                    <input type="submit" class="layui-btn layui-bg-blue" value="搜 索" />
                    <button type="button" lay-on="addSuspect" class="layui-btn">添 加</button>
                </form>
            </div>
        </div>

        <script id="listData" type="text/html">
            {{#  layui.each(d.data, function(index, item){ }}
            <div style="border:1px solid #ddd;"></div>
            <article id="list{{item.id}}" class="pyq-list auto-list clearfix">

                <div class="pyq-main fr pyqinfo-list" id="pyqinfo-list-267">
                    <section class="pyq-content">
                        <div class="pyq-intro" id="intro-267" title="本溪关门山国家森林公园一日游">
                            <div>失信者：{{item.suspect}}</div>
                            <div>受害者：{{item.victim}}</div>
                            <div>Email：{{item.email}}</div>
                            <div>{{# if(item.status == 1){ }}身份确认：确认骗子</div>
                            <div>{{# }else{ }}身份确认：疑似骗子{{# } }}</div>
                            <div>备注：{{item.remarks}}</div>
                            <div>添加时间：{{item.createTime}}</div>
                        </div>
                        <div class="midea-img-box img7">
                            {{#  layui.each(item.showImg, function(index, d){ }}
                            <figure class="pyq-content-media midea-img0" style="box-shadow: 0 2px 12px 0 rgba(0,0,0,.1);">
                                <a class="view-image" href="/{{d.img}}" data-fancybox="gallery-{{item.id}}" >
                                    <img class="ue-image" src="/{{d.thumbImg}}" />
                                </a>
                            </figure>
                            {{#  }); }}
                        </div>
                    </section>
                    <footer class="pyq-footer">
                        <div class="pyq-info">
                            <span class="pyq-date" title="{{item.createTime}}">{{item.dayTime}}</span>
                        </div>
                    </footer>
                </div>
            </article>
            {{#  }); }}
        </script>

        <div id="view"></div>


        <footer class="pagination wow fadeInDown" style="visibility: visible; animation-name: fadeInDown;">
            <!----------分页显示-------->
            <div id="showpage"></div>
        </footer>

    </div>
</main>

{include file='layout/footer'}

<script>var cookieDomain = "https://itmkk.com/";</script>
<script src="{$view_path}/static/js/zh_tw.js"></script>
<script src="{$view_path}/static/js/custom.js"></script>
<script src="{$view_path}/static/js/fancybox.umd.js"></script>
<script src="{$view_path}/static/js/wow.min.js"></script>
<script>
    layui.use(['form','table', 'laytpl'], function(){
        var form = layui.form;
        var table = layui.table;
        var laytpl = layui.laytpl;
        var util = layui.util;

        // 数据列表
        table.render({
            elem: '#showpage',
            url:'/api/liar',
            page:true,
            where:{
                suspect:"{$Request.param.suspect?$Request.param.suspect:''}",
            },
            limit:12,
            response: {
                statusCode: 200 // 重新规定成功的状态码为 200，table 组件默认为 0
            },
            done:function(res,curr,count,origin){
                //console.log(res);
                var getTpl = document.getElementById('listData').innerHTML; // 获取模板字符
                var elemView = document.getElementById('view'); // 视图对象
                // 渲染并输出结果
                laytpl(getTpl).render(res, function(str){
                    elemView.innerHTML = str;
                });
            }
        });

        // 提交事件
        form.on('submit(doSubmit)', function(data){
            //var field = data.field; // 获取表单字段值
            var field = new FormData($('#fieldData')[0]); // 获取表单字段值
            var loading = layer.load(1,{icon:6,shade:0.3});
            // 此处可执行 Ajax 等操作
            $.ajax({
                url:'/index/liar/saveAt',
                type:'post',
                data:field,
                async:true,  //true发送异步请求,false发送同步请求
                processData: false,  // 告诉jQuery不要去处理发送的数据
                contentType: false,   // 告诉jQuery不要去设置Content-Type请求头
                success:function(data){
                    let res = JSON.parse(data)
                    if(res.code == 200){
                        layer.closeAll();
                        layer.msg(res.message,{icon:6,shade:0.3});
                        //重置表单
                        $('#fieldData')[0].reset();
                        //更新token
                        $('#__token__').val(res.token);
                    }else{
                        layer.close(loading);
                        layer.msg(res.message,{icon:6,shade:0.3});
                        //更新token
                        $('#__token__').val(res.token);
                    }
                    //console.log(data);
                }
            });
            return false; // 阻止默认 form 跳转
        });

        util.on('lay-on',{
            // 添加失信者
            addSuspect:function(){
                layer.open({
                    type: 1,
                    title: '添加失信者信息',
                    shadeClose: true,
                    shade: 0.8,
                    area: ['60%', '80%'],
                    content: $('#showAdd') // iframe 的 url
                });
            },
            // 获取验证码
            getVercode: function(){
                var isvalid = form.validate('.sendEmail');
                // 验证通过
                if(isvalid){
                    let loading = layer.load(1,{icon:6,shade:0.3});
                    //倒计时
                    setTime(this);
                    //获取验证码
                    $.ajax({
                        url:'/index/liar/emailCode',
                        type:'post',
                        data: {
                            email:$("#email").val()
                        },
                        success:function(data){
                            let res = JSON.parse(data);
                            if(res.code == 200){
                                //关闭加载层
                                layer.close(loading);
                                layer.msg(res.message,{icon:6,shade:0.3});
                            }else{
                                //关闭加载层
                                layer.close(loading);
                                layer.msg(res.message,{icon:5,shade:0.3});
                            }
                        }
                    });
                }
            }
        });
        //倒计时
        var outTime = 60;
        function setTime(val){
            if(outTime == 0){
                $("#setOut").html('重新获取')
                $("#setOut").removeClass('layui-btn-disabled')
                $("#setOut").attr('lay-on','getVercode')
                outTime = 60
            }else{
                $("#setOut").html('倒计时'+outTime+'秒')
                $("#setOut").addClass('layui-btn-disabled')
                $("#setOut").removeAttr('lay-on')
                outTime--;
                setTimeout(function(){
                    setTime(val)
                },1000)
            }
        }

    });
</script>
</body>
</html>